/*
 * @Descripttion: 
 * @version: 
 * @Author: LLP
 * @Date: 2019-12-15 14:40:29
 * @LastEditors: LLP
 * @LastEditTime: 2019-12-15 14:52:37
 */


/**
 * @name: 密码校验
 * ----------------
 * @test: test font
 * @msg: 
 * @param {type} 
 * @return: 
 */
export function isPasswd(s)  {  
  var patrn=/^(\w){6,20}$/;
  if (!patrn.exec(s)) return false
    return true
 } 
 /**
 * 手机号中间4位****隐藏
 * --------------------
 * @param {*} mobile 手机号
 */
export function hideMobileInfo(mobile) {
  mobile = "" + mobile;
  var reg = /(\d{3})\d{4}(\d{4})/;
  return mobile.replace(reg, "$1****$2");
}
/**
* 邮箱号后4位****隐藏
* --------------------
* @param {*} email 邮箱账号
*/
export  function hideEmailInfo(email) {
  if (String(email).indexOf('@') > 0) {
      let newEmail, str = email.split('@'), _s = '';

      if (str[0].length > 4) {
          _s = str[0].substr(0, 4);
          for (let i = 0; i < str[0].length - 4; i++) {
              _s += '*';
          }
      } else {
          _s = str[0].substr(0, 1);
          for (let i = 0; i < str[0].length - 1; i++) {
              _s += '*';
          }
      }
      newEmail = _s + '@' + str[1];
      return newEmail;
  } else {
      return email;
  }
};